#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<vector>
using namespace std;
int main()
{
	int n, p, sum=0;
	cin >> n >> p;
	vector<int>val;
	vector<int>d_val;
	for (int i = 0; i < n; i++) {
		int m;	cin >> m;
		val.push_back(m);
		if (i)	d_val.push_back(val[i] - val[i - 1]);
		else    d_val.push_back(m);
	}
	for (int i = 0; i < p; i++) {
		int x, y, z;
		cin >> x >> y >> z;
		d_val[x-1] += z;
		if (y!=n)	d_val[y] -= z;
	}
	int min = d_val[0];
	for (int i = 0; i < n; i++) {
		sum += d_val[i];
		if (sum < min)	min = sum;
	}
	cout << min;
	return 0;
}